home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: scherrey@proteus-tech.com (Benjamin Scherrey)
- Newsgroups: comp.std.c++
- Subject: Re: Initialization of Static Components of a Template Class
- Date: 12 Jan 1996 10:05:02 PST
- Organization: Proteus Technologies, Inc.
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <4d51ah$3l1@cornerstone.intergate.net>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: 12 Jan 1996 07:06:57 GMT
- X-Newsreader: NeoLogic News for OS/2 [version: 4.2 UNREGISTERED 0 days remaining]
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMPai80y4NqrwXLNJAQG9XAH+Ih0FpUoyBgtZI2GKDFrZbBIRdgpl1154
- GzeFsPmviSBQK0qEIKeIC/HLUabFJf+JwpY4+hKOQ1mHC98OE+Ma8g==
- =X70p
- Originator: austern@isolde.mti.sgi.com
-
- In message <4cr2m1$1kcq@news.gate.net> - solution@gate.net (Ken Walter) writes:
- :>template<class T> int SOMEclass::AStatic(0);
- :>
- :>and have it automaticaly expanded by the compiler with the template class.
- :>
- :>Requiring the users of the template class to initialize ever class instance
- :>is very inconvenient!
-
- Very true - this is most inconvenient but has been required by every
- compiler I've used. It *is* my understanding, however that the following code
- (and your example above) are officially supported so compilers should be
- letting us do this Real Soon Now.
-
- --- code ----
-
- template< class T > int SOMEClass< T >::AStatic; // Note - statics are
- // initialized to zero
- // or their equivalent.
- // Don't put an explicit 0
- // in your templates!
- --- end code ---
-
- Regards,
-
- Ben Scherrey
- scherrey@proteus-tech.com
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-